var tableData = {
	url : ctp + "/uploadController/uploadMainSearch.shtml",
	propertys : [ "ATTACH_NAME","FILE_NAME","FILE_SIZE","REC_PERSON","REC_TIME"],
	hrefs : [["function=downs","recId=REC_ID","下载",null]],
	startLoad : function() {
		getListData(this);
	}
};
function searchData(curr) {
	setTagAndValue("form1", "curr", curr);
	tableData.startLoad();
}
$(document).ready(function() {
	searchData();
});

function dictAdd() {
	location.href=ctp+"/uploadController/upload.shtml";
}

function uploadDel(){
	var recIds=getCheckIds();	
	if(recIds==''){
		jalert("请选择记录！");
		return false;
	}
	jconfirm("del('"+recIds+"')","是否要删除所选附件？");	
}

function del(recIds) {
	 $.ajax({ 
		 	url: ctp + "/uploadController/uploadDel.shtml",
		    data: {recIds:recIds},
			type : 'POST',
			async:false, 
			success : function(result) {  
				if(result=="") {  
					jalert9("删除成功！"); 		
					  var curr = "1";
					  if($("#form1").find("#curr").length>0){
						  curr = $("#curr").val();
					  }
					  searchData(curr);
				} 		  
				else{     
					jalert(result);   
				} 
	  		}
		});
}

function downs(recId){
	 $.ajax({ 
		 	url: ctp + "/uploadController/download.shtml",
		    data: {recIds:recId},
			type : 'POST',
			async:false, 
			success : function(result) {
				window.open(ctp+result+"");
	  		}
		});
}
